import { request } from '../index'
const token = localStorage.getItem('Authorization') ?
  localStorage.getItem('Authorization') : '';

export function getUserInfo() {
  return request({
    url: '/my/userinfo',
    headers: {
      Authorization: token
    }
  })
}

export function updateUserInfo(data) {
  return request({
    url: '/my/userinfo',
    method: 'post',
    headers: {
      Authorization: token
    },
    data
  })
}

export function changePassword(oldPwd,newPwd) {
  return request({
    url: '/my/updatepwd',
    method: 'post',
    headers: {
      Authorization: token
    },
    data:{
      oldPwd,
      newPwd
    }
  })
}